<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {:widget_st('layui','css')}
  {:widget_st('admin','css')}
</head>
{:do_action('admin_head')}
<body>

  <div class="layui-fluid">
    <div class="layui-card">
      <form onclick="return false;" class="info_tj">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
          <div class="layui-form-item">
            
            <div class="layui-inline">
              <label class="layui-form-label">名称</label>
              <div class="layui-input-block">
                <input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">Model</label>
              <div class="layui-input-inline">
                <input type="text" name="model" placeholder="请输入" autocomplete="off" class="layui-input">
              </div>
            </div>
             <div class="layui-inline">
              <label class="layui-form-label">排序</label>
              <div class="layui-input-block">
                <input type="text" name="sort" placeholder="请输入" autocomplete="off" class="layui-input">
              </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-sm " onclick="tijiao_data('/admin/category/category_model_add',0)"  >新增</button>
            </div>
          </div>
        </div>
      </form>

      <div class="layui-card-body">
        <table class="layui-table">
            <colgroup>
              <col width="30">
              <col width="60">
              <col width="60">
              <col width="50">
              <col width="50">
              <col width="50">
              <col>
            </colgroup>
            <thead>
              <tr>
                <th>ID</th>
                <th>名称</th>
                <th>Model</th>          
                <th>排序</th>
                <th>状态</th>
                <th>操作</th>
              </tr> 
            </thead>
            <tbody>
              <?php foreach($list as $k=>$vo){ ?>
                <tr>
                  <td>{$vo['id']}</td>
                  <td>
                    <?php if(ZFC("webconfig.isshow_form_parm")==1){ ?>
                    <a  onclick='zfAdminShow("设置静态文件","{:url('admin/setting/category_form_parm',['id' => $vo['id'],'tb_name'=>'zf_category_model'] )}?t=4")' >
                    <?php }else{ ?>
                    <a href="#">
                    <?php } ?>
                    {$vo['name']}
                      </a>
                  </td>
                  <td>{$vo['model']}</td>
                  <td>{$vo['sort']}</td>
                  <td> 
                    <div class=" layui-form" lay-filter="component-form-element">        
                       <input type="checkbox" name="status" <?php echo $vo['status']==1?'checked':''; ?> lay-skin="switch" lay-text="开启|关闭" lay-filter="status_change" item="{$vo['id']}">
                    </div>
                  </td>
                  <td>  
                      <button class="layui-btn layui-btn-sm" onclick='zfAdminShow("编辑","{:url('admin/category/category_model_edit',['id' => $vo['id']] )}",800)'>编辑</button>
                    <?php if($vo['is_parm']==1){ ?>
                      <button class="layui-btn layui-btn-sm" onclick='zfAdminShow("参数列表","{:url('admin/category/category_model_parm',['mid' => $vo['id']] )}")'>设置参数</button>
                      <a target="_blank" href="{:url('category/category_model',['t'=>'export','id'=>$vo['id']])}">导出</a>
                      <a  onclick='zfAdminShow("导入","{:url('admin/category/category_model',['id' => $vo['id'],'t'=>'import'] )}")'>导入</a>
                    <?php } ?>
                  </td>
                </tr>
              <?php } ?>         
            </tbody>
          </table>
      </div>
    </div>
  </div>

  {:widget_st('jq','js')}
  {:widget_st('layui','js')}  
  {:widget_st('common','js')} 
  <script>
 layui.use([ 'table','element'], function(){
    var $ = layui.$
    ,form = layui.form
    ,element = layui.element
    ,table = layui.table;

    form.on('switch(status_change)', function(data){
      var id = $(this).attr("item")
      var dbname = 'category_model'
      var status = this.checked ? '1' : '0'
      console.log(id)
      $.get("{:url('admin/common/is_switch')}",{id:id,dbname:dbname,status:status},function(res){
          if(res.result==1){
            layer.msg(res.msg, {icon: 1});
          }else{
            layer.msg(res.msg, {icon: 2});
          }
        },"json");
    });


    
    
 
   
  });
  </script>
</body>
</html>
{:do_action('admin_js')}
